<html>
<head>
<title>oPanel V1</title>
<link rel="shortcut icon" href="favicon.ico" />
<link rel="stylesheet"href="style.css">
<?
include("functions.php");
$location = $_POST['dir'];
$dir1 = stripslashes("$location");
$dir = "$dir1";
$filename = $_POST['filename'];
$file = "$dir$filename";
$u = $_POST['u'];
$g = $_POST['g'];
$w = $_POST['w'];
$mod = '0'.$u.$g.$w;
$perm = octdec($mod);
if (!function_exists('ftp_chmod')) {
   function ftp_chmod($ftp_stream, $mode, $filename)
   {
       return ftp_site($ftp_stream, sprintf('CHMOD %o %s', $mode, $filename));
   }
}

//--
?>
</head>
<body>
<center><img src="images/logo.png"></center>
<b>Set permissions on <? echo $filename; ?> -> <? echo $mod; ?>
</b>  <i></i> 
<?
// set up basic connection
$conn_id = ftp_connect($ftp_server);

// login with username and password
$login_result = ftp_login($conn_id, $ftp_username, $ftp_userpass);

ftp_chmod($conn_id, $perm, "$file");
ftp_close($conn_id);
?>
<script type="text/javascript">
parent.filemain.location="http://<? echo $_SERVER["HTTP_HOST"]; echo dirname("$_SERVER[SCRIPT_NAME]"); ?>/list.php?dir=<? echo $dir; ?>";
</script>
</body>
</html>